package xyz.liut.autolaunch;

import android.app.KeyguardManager;
import android.content.Context;
import android.os.PowerManager;

/**
 * 系统工具
 * <p>
 * Create by liut on 20-10-29
 */
public class SystemUtils {

    /**
     * 当前是否亮屏
     */
    public static boolean isScreenOn(Context context) {
        PowerManager powerManager = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
        return powerManager.isInteractive();
    }

    /**
     * 当前是否锁定
     */
    public static boolean isLocked(Context context) {
        KeyguardManager mKeyguardManager = (KeyguardManager) context.getSystemService(Context.KEYGUARD_SERVICE);
        return mKeyguardManager.inKeyguardRestrictedInputMode();
    }

}
